<template>
  <div class="seller-warp" ref="seller">
    <div class="content">
      <div class="overview">
        <div class="title">
          <div class="left">
            <h1 class="name">{{seller.name}}</h1>
            <star :size="36" :score="seller.score"></star>
            <span class="sellCount">({{seller.score}})</span>
            <span class="sellCount">月售{{seller.sellCount}}单</span>
          </div>
          <div class="nice" @click="isnice=!isnice">
            <i class="fa fa-heart" :class="{active:isnice}"></i>
            <span class="info">{{isnice?"已收藏":"收藏"}}</span>
          </div>
        </div>
        <div class="content">
          <div class="num-item">
            <div class="item-name">起送价</div>
            <div class="item-value">
              <span class="num">{{seller.minPrice}}</span>元
            </div>
          </div>
          <div class="num-item">
            <div class="item-name">商家配送</div>
            <div class="item-value">
              <span class="num">{{seller.deliveryPrice}}</span>元
            </div>
          </div>
          <div class="num-item">
            <div class="item-name">平均配送时间</div>
            <div class="item-value">
              <span class="num">{{seller.deliveryTime}}</span>分钟
            </div>
          </div>
        </div>
      </div>
      <split></split>
      <div class="bulletin">
        <h1 class="h1">公告与活动</h1>
        <p>{{seller.bulletin}}</p>
        <ul>
          <li v-for="support in seller.supports" class="supports">
            <span class="icon" :class="classMap[support.type]"></span>
            <span class="text">{{support.description}}</span>
          </li>
        </ul>
      </div>
      <split></split>
      <div class="imgs">
        <h1 class="h1">
          商家实景
        </h1>
        <div class="img-box" ref="imgs">
          <ul class="img-items" ref="imgbox" :style="'width:'+imgsWidth+'px'">
            <li class="img-item" v-for="url in seller.pics">
              <img :src="url" width="120" height="90">
            </li>
          </ul>
        </div>
      </div>
      <split></split>
      <div class="infos">
        <h1 class="h1">
          商家信息
        </h1>
        <ul class="items">
          <li class="item" v-for="info in seller.infos">
            {{info}}
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script type="text/ecmascript-6">
  import star from '../star/star.vue'
  import split from '../split.vue'
  import Scroll from 'better-scroll'
  import ajax from '@data'
  export default {
    created(){
      //ul给宽
      let len =this.seller.pics.length;
      this.imgsWidth = len*120+(len-1)*6

      this.$nextTick(()=>{
        this.sellerScroll = new Scroll(this.$refs.seller,{
          click:true
        });
        //商家实景滚动
        this.imgsScroll = new Scroll(this.$refs.imgs,{
          scrollX:true,
          eventPassthrough:"vertical"
        });
      })
    },
    mounted(){

    },
    props:{
      seller:{
        type:Object,
        default(){
          return {}
        }
      }
    },
    data () {
      return {
        scroll:null,
        isnice:false,
        classMap:["decrease","discount","special","invoice","guarantee"],
        imgsWidth:0,
      }
    },
    methods:{

    },
    computed:{
    },
    watch:{

    },
    components:{
      star,split
    }
  }
</script>

<style  lang="stylus" rel="stylesheet/styleus">
  @import "../../common/stylus/mixin"
  .seller-warp
    position absolute
    top 174px
    left 0
    bottom 0
    width 100%
    overflow hidden
    .overview
      padding 18px
      .title
        display flex
        padding-bottom 18px
        border-bottom 1px solid rgba(7,17,27,.1)
        .left
          flex 1
          font-size 0
          .name
            font-size 14px
            margin-bottom 8px
          .sellCount
            padding-left 8px
            font-size 10px
            line-height: 15px
            vertical-align: top
            color rgb(77,85,93)
            display inline-block
        .nice
          flex 0 0 40px
          text-align center
          font-size 0
          .fa
            font-size 24px
            color: #efefef
            margin-bottom 4px
            &.active
              color rgb(240,20,20)
          .info
            display inline-block
            font-size 10px
      .content
        padding-top 18px
        display flex
        .num-item
          flex 1
          text-align center
          border-right 1px solid rgba(7,17,27,.1)
          &:last-child
            border none
          .item-name
            font-size 10px
            color rgb(147,153,159)
            margin-bottom 4px
          .item-value
            font-size 10px
            .num
              font-size 24px
              font-weight 200
    .bulletin
      padding 18px
      padding-bottom 0
      .h1
        font-size 14px
        margin-bottom 8px
      p
        padding 0 12px 18px 12px
        text-align justify
        font-size 12px
        line-height 24px
        color rgb(240,20,20)
      .supports
        padding 0 12px
        line-height 48px
        border-top 1px solid rgba(7,17,27,.1)
        .icon
          display inline-block
          width 16px
          height 16px
          margin-right 6px
          background-size 16px
          background-repeat no-repeat
          vertical-align: middle
          &.decrease
            bg-img("decrease_4")
          &.discount
            bg-img("discount_4")
          &.guarantee
            bg-img("guarantee_4")
          &.invoice
            bg-img("invoice_4")
          &.special
            bg-img("special_4")
        .text
          font-size 12px

    .imgs
      padding 18px
      font-size 0
      .h1
        font-size 14px
        margin-bottom 8px
      .img-box
        overflow hidden
        .img-items
          display flex
          .img-item
            flex 1
            flex-wrap nowrap
            margin-right 6px
            border-radius 1px
          &:last-child
            margin-right 0

    .infos
      padding 18px
      .h1
        font-size 14px
        margin-bottom 12px
      .items
        .item
          font-size 12px
          line-height 14px
          border-top 1px solid rgba(7,17,27,.1)
          padding 14px 12px
/*
  <div class="imgs">
        <ul class="items">
          <li class="item" v-for="info in seller.infos">
            {{info}}
          </li>
        </ul>
      </div>
    </div>
*/
</style>
